package com.test.springboot.alicloudoss.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @author thinkpad - 83start
 * @version v1.0
 * @create 2022/8/10 18:40
 * @package com.test.springboot.alicloudoss.config
 * @description 阿里云OSS 的配置文件
 */
@Configuration
@PropertySource(value = {"classpath:application.yml"})
@ConfigurationProperties(prefix = "aliyun")
@Data
public class AliCloudOssConfig {
    
    private String endpoint;
    private String accessKeyId;
    private String accessKeySecret;
    private String bucketName;
    private String urlPrefix;

    @Bean
    public OSS getOssClient() {
        return new OSSClient(endpoint, accessKeyId, accessKeySecret);
    }

}
